package com.mingzhi.lotterysystem.common.exception;

import com.mingzhi.lotterysystem.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ServiceException extends RuntimeException{
    /**
     * @see com.mingzhi.lotterysystem.common.errorcode.ServiceErrorCodeConstants
     */
    private Integer code;
    private String massage;

    //序列化
    public ServiceException() {
    }

    public ServiceException(Integer code, String massage) {
        this.code = code;
        this.massage = massage;
    }

    public ServiceException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.massage = errorCode.getMsg();
    }
}
